"""Definition of the Administrativo content type
"""

from zope.app.component.hooks import getSite
from zope.interface import implements

from Products.Archetypes import atapi
from Products.ATContentTypes.content import folder
from Products.ATContentTypes.content import schemata

from AccessControl import ClassSecurityInfo

from cintra.types.content import cintrauser
from cintra.types.interfaces import IAdministrativo
from cintra.types.config import PROJECTNAME
from cintra.types.content.schemas.administrativo import AdministrativoSchema

from cintra.policy.utils.roles import ADMINISTRATIVO_GROUP


#schemata.finalizeATCTSchema(
    #AdministrativoSchema,
    #folderish=True,
    #moveDiscussion=False
#)


class Administrativo(cintrauser.CINTRAUser):
    """Administrativo type for Cintra website"""
    implements(IAdministrativo)

    meta_type = "Administrativo"
    schema = AdministrativoSchema
    
    security = ClassSecurityInfo()    
    
    def getGroup(self):
        return ADMINISTRATIVO_GROUP    

    def get_home_url(self):
        portal = getSite()
        return portal.absolute_url_path() + '/view'


    def at_post_create_script(self):
        cintrauser.CINTRAUser.at_post_create_script(self)
#        self.setSignPassword('senha1') 


atapi.registerType(Administrativo, PROJECTNAME)
